package com.sdjzu.wanfuying.androiddesign.mvvm.coolapk.type;

import android.util.Log;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import com.sdjzu.wanfuying.androiddesign.R;

import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;

public class TypeViewHolderFactory {
    private static final String TAG = "TypeViewHolderFactory";

    @NonNull
    public static RecyclerView.ViewHolder inflate(LayoutInflater inflater, ViewGroup parent, int type) {
        switch (type) {
            case 0:
                return new Type0ViewHolder(DataBindingUtil.inflate(inflater, R.layout.activity_coolapk_item_0, parent, false));
            case 1:
                return new Type1ViewHolder(DataBindingUtil.inflate(inflater, R.layout.activity_coolapk_item_1, parent, false));
            case 2:
                return new Type2ViewHolder(DataBindingUtil.inflate(inflater, R.layout.activity_coolapk_item_2, parent, false));
            default:
                Log.d(TAG, "inflate: do not support this type");
                return new UnknownTypeViewHolder(DataBindingUtil.inflate(inflater, R.layout.activity_coolapk_item_unknown, parent, false));
        }
    }
}
